package com.presto.directo.net

import com.presto.directo.BuildConfig
import com.presto.directo.entity.*
import io.reactivex.rxjava3.core.Observable
import okhttp3.*
import retrofit2.http.*

interface ApiService {

    companion object {
        const val TestUrl = "http://8.130.11.117:18086/"
        const val ProductUrl = "https://openapi.prestodirecto.mx/"
        var BaseUrl = if (BuildConfig.DEBUG) TestUrl else ProductUrl
        const val URL = "send"
        const val FILE_URL = "sendfile"

        const val URL_QUESTION = "http://h5.prestodirecto.mx/#/question"
        const val URL_PRIVATE = "http://h5.prestodirecto.mx/#/privacy"
        const val URL_CONTRACT = "http://h5.prestodirecto.mx/#/contract"
    }

    @GET("http://pv.sohu.com/cityjson?ie=utf-8")
    suspend fun getIpAddress(): ResponseBody

    @POST(FILE_URL)//1
    suspend fun uploadImage(@Body body: RequestBody): BaseEntity<FileEntity>

    @POST(URL)//2
    suspend fun getConfig(@Body map: MutableMap<String, Any?>): BaseEntity<ConfigEntity>

    @POST(URL)//3
    suspend fun checkUpdate(@Body map: MutableMap<String, Any?>): BaseEntity<VersionEntity>

    @POST(URL)//4
    suspend fun sendSms(@Body map: MutableMap<String, Any?>): BaseEntity<Any>

    @POST(URL)//5,7,8,36,37,45
    suspend fun push(@Body map: MutableMap<String, Any?>): BaseEntity<Any>

    @POST(URL)//6
    suspend fun register(@Body map: MutableMap<String, Any?>): BaseEntity<UserEntity>

    @POST(URL)//11
    suspend fun getDataStatus(@Body map: MutableMap<String, Any?>): BaseEntity<DataStatusEntity>

    @POST(URL)//29
    suspend fun getCityList(@Body map: MutableMap<String, Any?>): BaseEntity<List<CityEntity>>

    @POST(URL)//12
    suspend fun saveCityInfo(@Body map: MutableMap<String, Any?>): BaseEntity<Any>

    @POST(URL)//13
    suspend fun getCityInfo(@Body map: MutableMap<String, Any?>): BaseEntity<PersonInfoEntity>

    @POST(URL)//16
    fun saveWorkInfo(@Body map: MutableMap<String, Any?>): Observable<BaseEntity<Any>>

    @POST(URL)//15
    suspend fun getWorkInfo(@Body map: MutableMap<String, Any?>): BaseEntity<WorkEntity>

    @POST(URL)//17
    suspend fun saveQuestion(@Body map: MutableMap<String, Any?>): BaseEntity<Any>

    @POST(URL)//18
    suspend fun getQuestion(@Body map: MutableMap<String, Any?>): BaseEntity<QuestionEntity>

    @POST(URL)//19
    suspend fun deleteCard(@Body map: MutableMap<String, Any?>): BaseEntity<Any>

    @POST(URL)//20
    suspend fun addCard(@Body map: MutableMap<String, Any?>): BaseEntity<Any>

    @POST(URL)//21
    suspend fun getCards(@Body map: MutableMap<String, Any?>): BaseEntity<List<UserCardEntity>>

    @POST(URL)//22
    suspend fun getPersonInfo(@Body map: MutableMap<String, Any?>): BaseEntity<PersonInfoEntity>

    @POST(URL)//23
    suspend fun savePersonInfo(@Body map: MutableMap<String, Any?>): BaseEntity<Any>

    @POST(URL)//24
    suspend fun saveContract(@Body map: MutableMap<String, Any?>): BaseEntity<Any>

    @POST(URL)//25
    suspend fun getContact(@Body map: MutableMap<String, Any?>): BaseEntity<ContactEntity>

    @POST(URL)//26
    suspend fun getLoanStatus(@Body map: MutableMap<String, Any?>): BaseEntity<LoanStatusEntity>

    @POST(URL)//27
    suspend fun changeCard(@Body map: MutableMap<String, Any?>): BaseEntity<Any>

    @POST(URL)//28
    suspend fun loan(@Body map: MutableMap<String, Any?>): BaseEntity<Any>

    @POST(URL)//30
    suspend fun getProducts(@Body map: MutableMap<String, Any?>): BaseEntity<List<ProductEntity>>

    @POST(URL)//14
    suspend fun getRecord(@Body map: MutableMap<String, Any?>): BaseEntity<List<LoanStatusEntity>>

    @POST(URL)//31
    suspend fun queryBankList(@Body map: MutableMap<String, Any?>): BaseEntity<List<BankEntity>>

    @POST(URL)//32
    suspend fun queryCreditBank(@Body map: MutableMap<String, Any?>): BaseEntity<CreditBankEntity>

    @POST(URL)//33
    suspend fun repay(@Body map: MutableMap<String, Any?>): BaseEntity<RepayInfoEntity>

    @POST(URL)//38
    suspend fun compare(@Body map: MutableMap<String, Any?>): BaseEntity<CompareEntity>

    @POST(URL)//42
    suspend fun getAppList(@Body map: MutableMap<String, Any?>): BaseEntity<List<AppEntity>>

    @POST(URL)//46
    suspend fun queryExtensionInfo(@Body map: MutableMap<String, Any?>): BaseEntity<ExtensionEntity>

    @POST(URL)//47
    suspend fun getOtherAppList(@Body map: MutableMap<String, Any?>): BaseEntity<AdvertisingEntity>

    @POST(URL)//48
    suspend fun getPlan(@Body map: MutableMap<String, Any?>): ResponseBody

}